<section style="overflow-y: scroll;margin-bottom:20px;" class="Hui-article-box">
    <div class="panel panel-default">
	<div class="panel-header">轮播设置</div>
        <div class="panel-body">
            <article class="cl pd-20">
                <div class="cl pd-5 bg-1 bk-gray mt-20">
                    <span class="l"> 
                        <a href="javascript:;" onclick="addswiper('添加轮播', '/admin/config/addswiper', '800', '500')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i>添加轮播</a> 
                    </span>
                </div>
                <table class="table table-border table-bordered table-bg">
                    <thead>
                        <tr>
                            <th scope="col" colspan="9">列表</th>
                        </tr>
                        <tr class="text-c">
                            <th width="40">ID</th>
                            <th width="90">图片</th>
                            <th width="90">文字</th>
                            <th width="130">链接</th>
                            <th width="90">创建时间</th>
                            <th width="100">操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach($datalist as $k=>$v){ ?>
                        <tr class="text-c">
                            <td>{$v['id']}</td>
                            <td>
                                <img width="100" src="<?=$v['imgurl']?>"/>
                            </td>
                            <td><?=$v['text']?></td>
                            <td><?=$v['url']?></td>
                            <td><?=$v['create_time']?></td>
                            <td>
                                <a title="编辑" href="javascript:;" onclick="editswiper('管理员编辑', '/admin/config/addswiper?id={$v['id']}', '1', '800', '500')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a> 
                                <a title="删除" href="javascript:;" onclick="delswiper(this, {$v['id']})" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
                            </td>
                        </tr>
                        <?php } ?>
                    </tbody>
                </table>
            </article>
        </div>
    </div>
</section>
<script type="text/javascript" src="/static/lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="/static/lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="/static/lib/laypage/1.2/laypage.js"></script> 
<script type="text/javascript">
function addswiper(title,url,w,h){
    layer_show(title,url,w,h);
}
/*管理员-删除*/
function delswiper(obj,id){
    layer.confirm('确认要删除吗？',function(index){
        //此处请求后台程序，下方是成功后的前台处理……
        $.get('/admin/config/deleteswiper?id='+id).then(function(res){
            if(res.ret==0) {
                layer.msg(res.message,{icon:1,time:1000});
                $(obj).parents("tr").remove();
            }else{
                layer.msg(res.message);
            }
        })
        
    });
}
/*管理员-编辑*/
function editswiper(title,url,id,w,h){
    layer_show(title,url,w,h);
}
/*管理员-停用*/
function admin_stop(obj,id){
    layer.confirm('确认要停用吗？',function(index){
        //此处请求后台程序，下方是成功后的前台处理……

        $(obj).parents("tr").find(".td-manage").prepend('<a onClick="admin_start(this,id)" href="javascript:;" title="启用" style="text-decoration:none"><i class="Hui-iconfont">&#xe615;</i></a>');
        $(obj).parents("tr").find(".td-status").html('<span class="label label-default radius">已禁用</span>');
        $(obj).remove();
        layer.msg('已停用!',{icon: 5,time:1000});
    });
}

/*管理员-启用*/
function admin_start(obj,id){
    layer.confirm('确认要启用吗？',function(index){
        //此处请求后台程序，下方是成功后的前台处理……
        $(obj).parents("tr").find(".td-manage").prepend('<a onClick="admin_stop(this,id)" href="javascript:;" title="停用" style="text-decoration:none"><i class="Hui-iconfont">&#xe631;</i></a>');
        $(obj).parents("tr").find(".td-status").html('<span class="label label-success radius">已启用</span>');
        $(obj).remove();
        layer.msg('已启用!', {icon: 6,time:1000});
    });
}
</script> 
